/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * VendaBrowser.java
 *
 * Created on 19/05/2011, 23:19:26
 */
package br.com.softnight.ui;

import br.com.softnight.ui.tablemodel.TableModelBrowserVenda;
import java.sql.SQLException;
import java.sql.Date;
import javax.swing.table.TableColumn;

/**
 *
 * @author Franklin
 */
public class VendaBrowser extends javax.swing.JDialog {
    private TableModelBrowserVenda tableModelBrowserVenda = new TableModelBrowserVenda();
    private TableColumn tableColumnId = new TableColumn(0, 20);
    private TableColumn tableColumnCliente = new TableColumn(1, 40);
    private TableColumn tableColumnData = new TableColumn(2, 20);

    /** Creates new form VendaBrowser */
    public VendaBrowser(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
        
        this.jTable1.setModel(tableModelBrowserVenda);
        this.jTable1.addColumn(this.tableColumnId);
        this.jTable1.addColumn(this.tableColumnCliente);
        this.jTable1.addColumn(this.tableColumnData);
    }
    
    public void consulta(Long id, Long clienteId, Date data ) throws SQLException {
        this.tableModelBrowserVenda.atualiza(id, clienteId, data);
        this.setLocationRelativeTo(null);
        this.setVisible(true);
    }
            
    public void getSelectedBean() throws SQLException {
        
    }

    public void getSelectedBeanId() throws SQLException {
        this.getSelectedBean();        
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jScrollPane1 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();
        btnInsere = new javax.swing.JButton();
        btnEdita = new javax.swing.JButton();
        btnExclui = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        jTable1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane1.setViewportView(jTable1);

        btnInsere.setText("Insere");

        btnEdita.setText("Edita");

        btnExclui.setText("Exclui");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 380, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(btnInsere)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(btnEdita)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(btnExclui)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 244, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnInsere)
                    .addComponent(btnEdita)
                    .addComponent(btnExclui))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnEdita;
    private javax.swing.JButton btnExclui;
    private javax.swing.JButton btnInsere;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTable jTable1;
    // End of variables declaration//GEN-END:variables
}
